package com.unicomcz.commision;

import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.unicomcz.ActionBase;

public class TotalJfAction extends ActionBase
{
    private List<TotalJf> tc;
    private String acctMonth="";
    public List<TotalJf> getTc()
    {
        return tc;
    }
    public void setTc(List<TotalJf> tc)
    {
        this.tc = tc;
    }
    public String getAcctMonth()
    {
        return acctMonth;
    }
    public void setAcctMonth(String acctMonth)
    {
        this.acctMonth = acctMonth;
    }
    public String executeAction(){
        log = Logger.getLogger(this.getClass());  
        tc = new ArrayList<TotalJf>();
        String sqlStr="SELECT acct_month,sign_score,max_allowance,done_score,int_complete,dev_2g,jf_2g,dev_3g,jf_3g,comm_jfcl";
        sqlStr += " FROM DLS_TOTAL_score where depart_code=? and acct_month=?";
        if (!query("dls",tc,sqlStr)) {
            //执行查询失败
            return "fail";
        }
        return SUCCESS;
    }
    protected void regQueryParam() throws Exception{
        if ((acctMonth==null)||(acctMonth.length()==0)) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
            acctMonth=sf.format(new java.util.Date());
        }
        pstmt.setString(1, userInfo.getDepartCode());
        pstmt.setString(2, acctMonth);
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        TotalJf t = new TotalJf();
        t.setAcctMonth(rs.getString(1));
        t.setIntContract(rs.getString(2));
        t.setMaxAllowance(rs.getString(3));
        t.setIntTotal(rs.getString(4));
        t.setIntComplete(rs.getString(5));
        t.setDev2g(rs.getString(6));
        t.setInt2g(rs.getString(7));
        t.setDev3g(rs.getString(8));
        t.setInt3g(rs.getString(9));   
        t.setJfcl(rs.getString(10));
        out.add(t);
        
    }
}
